<?php namespace Admin\Controller;

use Admin\Model\Config;

class ConfigController extends AuthController{

    protected $db;
	//构造函数
	public function __init()
	{
        $this->db = new Config;
	}

    //动作
    public function index(){
      $data = $this->db->getAll();
      View::with('data',$data)->make();
    }

    public function update()
    {
        if($this->db->update())
        {
            $this->ajax(array('code'=>0,'message'=>'修改成功'));
        }
        else
        {
            $this->ajax(array('code'=>1,'message'=>$this->db->getError()));
        }
    }
}
